<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('专用报表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
								<label>报表类型：</label>
								<select name="params[bbbh]" id="bbbh">
									<option th:each="bb:${zybblist}" th:text="${bb.bbbh}+'-'+${bb.kmdm}+'['+${bb.bbmc}+']'" th:value="${bb.bbbh}"></option>
								</select>
							</li>
                              <li>
								<label>核算年度：</label>
								<select name="nd" id="nd">
									<option th:each="nd : ${ndlist}" th:text="${nd}" th:value="${nd}"> th:selected="${nd==year}"> </option>
								</select>
							</li>
                            <li >
								<label>核算期间： </label><select name="yf" id="yf">
								    <option th:each="yf : ${yflist}" th:text="${yf}" th:value="${yf}" th:selected="${yf==term}"></option>
								</select>
							</li>
							 <li >
								<label>查询级别： </label><select name="params[mxfs]" id="mxfs">
								    <option value="0">单位</option>
									<option value="1">部门</option>
								</select>
							</li>
							<li style="width:265px">
                                <label>起始单位：</label> 
	                                 <div class="input-group">
		                                <input class="form-control" type="text" ondblclick="selectsHsdwTree()" id="sdwbm"  name="params[sdwbm]">
		                        		<span class="input-group-addon"><i class="fa fa-search" onclick="selectsHsdwTree()"></i></span>
	                        		 </div> 
                            </li>
                            <li style="width:265px">
                               <label>终止单位：</label> 
	                                 <div class="input-group">
		                                <input class="form-control" type="text" ondblclick="selecteHsdwTree()" id="edwbm"  name="params[edwbm]">
		                        		<span class="input-group-addon"><i class="fa fa-search" onclick="selecteHsdwTree()"></i></span>
	                        		 </div> 
                            </li>
							 <li>
                                <label>清除为零的项：</label>
                                <input type="checkbox" name="params[yefs]" />
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
               
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:zybb:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "system/zybb";

        $(function() {
            var options = {
                url: prefix + "/list",
                exportUrl: prefix + "/export",
                modalName: "专用报表",
                pagination: false,
                columns: [	
	                {
	                    field: 'dwbm',
	                    title: '科目代码',
	                },{
	                    field: 'dwmc',
	                    title: '科目名称',
	                }, 
	                {
	                    field: 'qcye',
	                    align: 'right',
	                    title: '年初余额'
	                },
	                {
	                    field: 'jfje',
	                    align: 'right',
	                    title: '本月借方'
	                },
	                {
	                    field: 'bnjf',
	                    align: 'right',
	                    title: '本年借方'
	                },{
	                    field: 'dfje',
	                    align: 'right',
	                    title: '本月贷方',
	                },{
	                    field: 'bndf',
	                    align: 'right',
	                    title: '本年贷方',
	                },
	                {
	                    field: 'qmye',
	                    align: 'right',
	                    title: '期末余额'
	                    
	                }]
            };
            $.table.init(options);
        });
        
        /*核算单位-新增-选择父部门树*/
        function selectsHsdwTree() {
            var options = {
                title: '核算单位选择',
                width: "380",
                url: ctx + "system/hsdw/selectHsdwTree/",
                callBack: sdohsdwSubmit
            };
            $.modal.openOptions(options);
        }

        function sdohsdwSubmit(index, layero){
            var body = layer.getChildFrame('body', index);
               $("#sdwbm").val(body.find('#treeId').val());
               layer.close(index);
        }
        /*核算单位-新增-选择父部门树*/
        function selecteHsdwTree() {
            var options = {
                title: '核算单位选择',
                width: "380",
                url: ctx + "system/hsdw/selectHsdwTree/",
                callBack: edohsdwSubmit
            };
            $.modal.openOptions(options);
        }

        function edohsdwSubmit(index, layero){
            var body = layer.getChildFrame('body', index);
               $("#edwbm").val(body.find('#treeId').val());
               layer.close(index);
        }
    </script>
</body>
</html>